home *** CD-ROM | disk | FTP | other *** search
- /* ======================================== */
- /* FINAL WRITER AREXX MACRO */
- /* by Nigel S. Domaingue, 28/1/95 */
- /* */
- /* Script to goto Main Section. */
- /* $Ver: Goto_Main 1.0 (28/1/95) */
- /* ======================================== */
-
- /* Allows user to move to (almost) any Main section. */
- /* Only use if there are less than 6 sections. */
-
- /* This script is more complicated than the */
- /* other similar scripts as there can be */
- /* more than one main section. */
-
- Options Results
-
- toc = 'Table of Contents'
- tp = 'Title Page'
- ind = 'Index'
- bib = 'Bibliography'
- out = 'Outline'
-
- GetSectionList ","
- listing = Result
-
- /* The following is standard ARexx and */
- /* is not Final Writer specific. */
-
- /* Set up two stems (i.e. arrays) */
- x. = sections
- main. = Unused
- m = 0
-
- /* Split 'listing' into component parts */
- /* and put those into the x. stem. */
- PARSE VAR listing x.1 ',' x.2 ',' x.3 ',' x.4 ',' x.5 ',' x.6 ',' x.7 ',' x.8 ',' x.9 ',' x.10
- do i = 1 to 10
- IF ( LENGTH(x.i) = 0 ) THEN
- Do
- n = i-1
- i = 10
- end
- end
-
- /* The MAIN sections are isolated by elimination, */
- /* since they will likely have unique names whilst */
- /* contents and title pages are often unchanged. */
- /* If the names of other sections are changed, then */
- /* they will be treated as MAIN sections. */
-
- Do i = 1 to n
- a = x.i
- IF ( a = tp ) THEN NOP
- ELSE IF ( a = out ) THEN NOP
- ELSE IF ( a = toc ) THEN NOP
- ELSE IF ( a = bib ) THEN NOP
- ELSE IF ( a = ind ) THEN NOP
- ELSE DO
- m = m + 1
- main.m = '"'x.i'"'
- END
- END
-
- /* The user gets a choice iff there is more than */
- /* one section, via the ShowMessage requester. */
- /* This can only handle 3 options at a time, so */
- /* if there are more than 5 sections it is pretty */
- /* much useless and other ways are better. */
- If ( m = 1 ) THEN
- GoToSection main.m
- If ( m = 2 ) THEN
- Do
- ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 '""'
- jump = Result
- If ( jump = 1 ) Then GoToSection main.1
- If ( jump = 2 ) Then GoToSection main.2
- end
-
- If ( m = 3 ) THEN
- Do
- ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 main.3
- jump = Result
- If ( jump = 1 ) Then GoToSection main.1
- If ( jump = 2 ) Then GoToSection main.2
- If ( jump = 3 ) Then GoToSection main.3
- end
- If ( m = 4 ) THEN
- Do
- ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 '"Next Menu"'
- jump = Result
- If ( jump = 1 ) Then GoToSection main.1
- If ( jump = 2 ) Then GoToSection main.2
- If ( jump = 3 ) Then
- Do
- ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.3 main.4 '""'
- jump = Result
- If ( jump = 1 ) Then GoToSection main.3
- If ( jump = 2 ) Then GoToSection main.4
- end
- end
- If ( m = 5 ) THEN
- Do
- ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.1 main.2 '"Next Menu"'
- jump = Result
- If ( jump = 1 ) Then GoToSection main.1
- If ( jump = 2 ) Then GoToSection main.2
- If ( jump = 3 ) Then
- Do
- ShowMessage 1 0 '"There is more than one Main Section." "Select the one you wish to go to" ""' main.3 main.4 main.5
- jump = Result
- If ( jump = 1 ) Then GoToSection main.3
- If ( jump = 2 ) Then GoToSection main.4
- If ( jump = 3 ) Then GoToSection main.5
- end
- end
- If ( m > 5 ) THEN
- Do
- ShowMessage 1 0 '"There are more than five Main sections." "I suggest you use the G button instead." "" "Silly me" "" ""'
- end
-
-